$(function () {
    init();
});

function init() {
    advisoryType();
    getLogInfo();
}

function advisoryType() {
    slider.createSlide(".contentContainer", [{
        text: "<span class='am-icon-medkit'> 咨询</span>",
        pageIndex: 0
    }, {
        text: "<span class='am-icon-microphone'> 讲座</span>",
        pageIndex: 1
    }, {
        text: "<span class='am-icon-file-word-o'> 投稿</span>",
        pageIndex: 2
    }])
}
var data;
function getLogInfo() {
    advisoryService.getAdvisoryLogQueryList({
        "state":"100001"
    },function (data) {
        if(data.success){
            $(data.datas).each(function (i,rowData) {
            var row = $("<a href=\"javascript:void(0);\" class=\"weui-media-box weui-media-box_appmsg \"  data-target=\"#full\">\n" +
                "        <div class=\"weui-media-box__hd\">\n" +
                "            <img class=\"weui-media-box__thumb\"  src=\"\"  alt=\"\">\n" +
                "        </div>\n" +
                "        <div class=\"weui-media-box__bd\">\n" +
                "            <h4 id=\"advisoryCustomerId\" class=\"weui-media-box__title\">"+rowData.customerName+"</h4>\n" +
                "            <div id=\"advisoryTime\" class=\"time\">"+rowData.createTime.substr(0,10)+"</div>\n" +
                "            <p id=\"advisoryType\" class=\"weui-media-box__desc\">"+rowData.type+"</p>\n" +
                "        </div>\n" +
                "    </a>");
                $("#logInfo001").append(row);
                row.on("click",function (e) {
                window.location.href = "../chat/chat.html?customerId=" + rowData.customerId + "&id=" +rowData.id;
                });
            })
        } else {
            $.alert(data.errorMsg);
        }

    });
    advisoryService.getAdvisoryLogQueryList({
        "state":"100002"
    },function (data) {
        if(data.success){
            $(data.datas).each(function (i,rowData) {
                var row = $("<a href=\"javascript:void(0);\" class=\"weui-media-box weui-media-box_appmsg \"  data-target=\"#full\">\n" +
                    "        <div class=\"weui-media-box__hd\">\n" +
                    "            <img class=\"weui-media-box__thumb\"  src=\"\"  alt=\"\">\n" +
                    "        </div>\n" +
                    "        <div class=\"weui-media-box__bd\">\n" +
                    "            <h4 id=\"advisoryCustomerId\" class=\"weui-media-box__title\">"+rowData.customerName+"</h4>\n" +
                    "            <div id=\"advisoryTime\" class=\"time\">"+rowData.createTime.substr(0,10)+"</div>\n" +
                    "            <p id=\"advisoryType\" class=\"weui-media-box__desc\">"+rowData.type+"</p>\n" +
                    "        </div>\n" +
                    "    </a>");
                $("#logInfo002").append(row);
                row.on("click",function (e) {
                    window.location.href = "/wechat/html/doctor/pages/chat/chat.html?customerId=" + rowData.customerId + "&id=" +rowData.id;
                });
            })
        } else {
            $.alert(data.errorMsg);
        }

    });
}



